﻿@model DotaHelp.Models.Score

@{
    ViewBag.Title = "ItemTetrisResult";
}

<style>
    .tetrisItem {
        position:absolute;
        width:32px;
        height:32px;
    }
</style>

<h2>@Html.ShowUserName(Model.Author)     <span style="color:gold; font-weight:bold; font-size:20pt">@Model.Points</span> от @Model.Date.ToString()</h2>

@{
    var data = Model.GetDataInfo();
}

@Html.ActionLink("Ещё разок?", "ItemTetris")

<table>
    <tr>
        <td>
            <div style="position:relative;width:640px;height:416px;border:1px solid black" id="screen">
                
                @for (var y = 0; y < 13; y++)
                {
                    for (var x = 0; x < 20; x++)
                    {
                        if (data.Map[y * 20 + x] != 0)
                        {
                            @Html.LinkOnItem((ViewBag.Items[data.Map[y * 20 + x]] as Item), new { @class = "tetrisItem", style = "left:" + x * 32 + "px;top:" + y * 32 + "px" }, true);
                        }                        
                    }
                }
            </div>
            <h3>Собрал:</h3>
            <div>  
                @{
                    var sum = 0;
                }              
                @foreach (var id in data.Burned)
                {
                    sum += (ViewBag.Items[id] as Item).Recipes.Count;
                    @Html.LinkOnItem((ViewBag.Items[id] as Item))
                }
                <span style="display:none">@sum</span>
            </div>
        </td>
        <td style="vertical-align:top">
            @Html.Action("ScoresForGame", new { gameName = "ItemTetris"})
        </td>
    </tr>
</table>



<h3>Комментарии:</h3>
@Html.Comments("Дота тетрис", Url.Action("ItemTetrisResult", "Games", new { Model.Id }))